function [d, pi] = find_shortest_paths(G, s, adjacency_matrix)

colour = zeros(1, length(G));
d = inf * ones(1, length(G));
pi = inf * ones(1, length(G));

enqueued = [];
dequeued = [];

allExSource = setdiff(G, s)
for  i = 1:length(allExSource)
    u = allExSource(i);
    colour(u) = 0;
    d(u) = inf;
    pi(u) = inf;
end

colour(s) = 1;
d(s) = 0;
pi(s) = inf;

enqueued = [enqueued s];
while length(setdiff(enqueued, dequeued)) ~= 0
    indexOfNodeToDequeue = length(dequeued) + 1;
    u = enqueued(indexOfNodeToDequeue);
    dequeued = [dequeued u];
    
    neighbours = get_neighbour_nodes(adjacency_matrix, u);
    for i=1:length(neighbours)
        neighbourToAnalyze = neighbours(i);
        if colour(neighbourToAnalyze) == 0
            colour(neighbourToAnalyze) = 1;
            d(neighbourToAnalyze) = d(u) + 1;
            pi(neighbourToAnalyze) = u;
            enqueued = [enqueued neighbourToAnalyze];
        end
    end
    colour(u) = 2; 
end
   
end
